<template>
  <div>
    <p>{{ msg }}</p>
    <!-- 定义一个点击事件 overturn   -->        
    <button @click="overturn">{{press==true?'翻转':'返回'}}</button>
    
  </div>
</template>

<script>
export default {
  name: "VueJobApp",

  data() {
    return {
      msg: "周开心你好",
      press: true,
    };
  },

  mounted() {},

  methods: {
    overturn() {
      //当用户点击的时候获取data里面的msg数据转换成数组,调用翻转方法然后转换成字符串赋值给msg
      this.msg = this.msg.split("").reverse().join("");
      this.press = !this.press;
      console.log(!this.press);
    },
  },
};
</script>

<style lang="scss" scoped></style>
